package com.bbx.taxi.client.Bean.Attribute;

import java.util.ArrayList;

import android.app.Application;
import android.content.Context;

import com.bbx.api.sdk.model.official.passanger.Return.OrderList.OfficialOrderList;
import com.bbx.taxi.client.MyApplication;
import com.bbx.taxi.client.Bean.Value;
import com.bbx.taxi.client.Bean.Attribute.ChangeAttribute.OnContentFillingListener;
import com.bbx.taxi.client.Fragment.OfficialFragment;

/**
 * 主界面的信息临时存储
 */
public class MainAttribute {
	public boolean isNoListener=false;
	/**
	 * 主界面内容填写监听
	 * 
	 */
	public interface OnContentFillingListener {
		/**
		 * 主界面内容填写监听方法
		 */
		public void onContentFilling();
	};

	public OnContentFillingListener mOnContentFillingListener;

	public void setOnContentFillingListener(
			OnContentFillingListener hOnContentFillingListener) {
		mOnContentFillingListener = hOnContentFillingListener;
	}
	public void removeOnContentFillingListener(OnContentFillingListener hOnContentFillingListener){
		mOnContentFillingListener = null;
	}

	public static final int REQUEST_CODE_PERSON = 0;
	public static final int REQUEST_CODE_PERSON2 = 1;
	public static final int REQUEST_CODE_START_ADDRESS = 2;
	public static final int REQUEST_CODE_END_ADDRESS = 3;
	public static final int REQUEST_CODE_POINT_ADDRESS = 10;
	public static final int REQUEST_CODE_PLANE = 4;
	public static final int REQUEST_CODE_MESSAGE = 5;
	public static final int REQUEST_CODE_GOODS = 6;
	public static final int REQUEST_CODE_EDITNAME = 7;
	private String time = "现在出发";
	private String st_start_name = "";
	private String sn_start_name = "";
	private String st_start_city = "";
	private String sn_start_city = "";
	private String st_start_address = "";
	private String sn_start_address = "";
	private double st_start_longitude;
	private double sn_start_longitude;
	private double st_start_latitude;
	private double sn_start_latitude;
	private String st_end_name = "";
	private String sn_end_name = "";
	private String st_end_city = "";
	private String sn_end_city = "";
	private String st_end_address = "";
	private String sn_end_address = "";
	private double st_end_longitude;
	private double sn_end_longitude;
	private double st_end_latitude;
	private double sn_end_latitude;
	private String name = "";
	private String tel;
	private String name2 = "";
	private String tel2;
	private String message_kj = "";
	private String message_pc = "";
	private String message_bc = "";
	private String message_gw = "";
	private int goods_weight;// 物品重量
	private int goods_volume;// 物品体积
	private int count = 1;
	/**包车数量*/
	private int count_bc = 1;
	/** 判断是否是航班，0为不是，1为接机，2个送机 */
	private int plane_status;
	private String plane_numble;
	/**判断是否勾选条款*/
	private boolean  isCBclause=true;
	private int is_mutiple_oncar=0;
	private boolean isWf=false;
	private String vtypeTitle="";
	private String vtype=Value.list_vtype[0]+"";
	private int vtype_index;
	private String vtype_id="";
	private String seat_num="";
	private String level="";
	/**0为私有，1为委托，*/
	private int owner_type=0;//写死
	private String tc_id="";
	private String comboprice;//套餐价格
	private int estimate_time=Value.estimate_time;
	
	
	public int defaultOwn=Value.NOOWN;
	 /**自费方式，，1自费，0为公务*/
	public int own_expense=defaultOwn;
	
	private static MainAttribute main;

	public static MainAttribute getInstance() {
		if (main == null) {
			main = new MainAttribute();
			return main;

		} else
			return main;
	}
	public static void setNull(){
		setNullPosition();
		main=null;
	}
	public static void setNullPosition(){
		OfficialFragment.cb_position=OfficialFragment.default_cb_position;
		OfficialFragment.old_position=OfficialFragment.default_old_position;
	}
    public void setWf(boolean isWf){
    	this.isWf=isWf;
    	onContentFilling();
    }
    public boolean getWf(){
    	return isWf;
    }
    public void setVtype(String vtype){
    	this.vtype=vtype;
    	onContentFilling();
    }
    public String getVtype(){
    	if(vtype==null||vtype.equals("")){
			vtype=Value.vtype_null+"";
		}
    	return vtype;
    }
    public void setVtypeIndex(int vtype_index){
    	this.vtype_index=vtype_index;
    }
    public int getVtypeIndex(){
    	return vtype_index;
    }
    public void setVtypeId(String vtype_id){
    	this.vtype_id=vtype_id;
    	onContentFilling();
    }
    public String getVtypeId(){
    	return vtype_id;
    }
    public void setVtypeTitle(String vtypeTitle){
    	this.vtypeTitle=vtypeTitle;
    }
    public String getVtypeTitle(){
    	return vtypeTitle;
    }
    public void setSeat_num(String seat_num){
    	this.seat_num=seat_num;
    }
    public String getSeat_num(){
    	return seat_num;
    }
    public void setLevelCar(String level){
    	this.level=level;
    }
    public String getLevelCar(){
    	return level;
    }
    public void setOwner_type(int owner_type){
    	this.owner_type=owner_type;
    }
    public int getOwner_type(){
    	return owner_type;
    }
    public void setTc_id(String tc_id){
    	this.tc_id=tc_id;
    }
    public String getTc_id(){
    	return tc_id;
    }
    public void setComboPrice(String comboprice){
    	this.comboprice=comboprice;
    }
    public String getComboPrice(){
    	return comboprice;
    }
    public void setEstimate_time(int estimate_time){
    	this.estimate_time=estimate_time;
    }
    public int getEstimate_time(){
    	return estimate_time;
    }
	public void setTime(String time) {
		this.time = time;
		onContentFilling();
	}

	public String getTime() {
		return time;
	}

	public void setStartName(String st_start_name) {
		this.st_start_name = st_start_name;
		onContentFilling();
	}
	public void setStartName(String sn_start_name,boolean isCity) {
		if(isCity){
			this.sn_start_name = sn_start_name;
			onContentFilling();	
		}
		else{
			setStartName(sn_start_name);
		}

	}

	public String getStartName() {
		return st_start_name;
	}
	public String getStartName(boolean isCity) {
		if(isCity){
			return sn_start_name;	
		}
		else{
			return getStartName();
		}
		
	}

	public void setStartCity(String st_start_city) {
		this.st_start_city = st_start_city;
	}
	public void setStartCity(String sn_start_city,boolean isCity) {
		if(isCity){
			this.sn_start_city = sn_start_city;
		}
		else{
			setStartCity(sn_start_city);
		}
	
	}
	public String getStartCity() {
		try {
			if (st_start_city == null || st_start_city.equals("")||st_start_city.contains(Value.CITY_SPILT)
					||st_start_city.contains("\t")||st_start_city.contains("-")) {
				if(st_start_name.contains(Value.CITY_SPILT)){
					st_start_city = st_start_name.substring(0,
							st_start_name.indexOf(Value.CITY_SPILT));
				}
				else if(st_start_name.contains("\t")){
					st_start_city = st_start_name.substring(0,
							st_start_name.indexOf("\t"));
				}
				else if(st_start_name.contains("-")){
					st_start_city = st_start_name.substring(0,
							st_start_name.indexOf("-"));
				}
				else{
					st_start_city=st_start_name;
				}

			}
		} catch (Exception e) {
		}

		return st_start_city;
	}
	public String getStartCity(boolean isCity) {
		if(isCity){
			try {
				if (sn_start_city == null || sn_start_city.equals("")||sn_start_city.contains(Value.CITY_SPILT)
						||sn_start_city.contains("\t")||sn_start_city.contains("-")) {
					if(sn_start_name.contains(Value.CITY_SPILT)){
						sn_start_city = sn_start_name.substring(0,
								sn_start_name.indexOf(Value.CITY_SPILT));
					}
					else if(sn_start_name.contains("\t")){
						sn_start_city = sn_start_name.substring(0,
								sn_start_name.indexOf("\t"));
					}
					else if(sn_start_name.contains("-")){
						sn_start_city = sn_start_name.substring(0,
								sn_start_name.indexOf("-"));
					}
					else{
						sn_start_city=sn_start_name;
					}

				}
			} catch (Exception e) {
			}
			
			return sn_start_city;
		}
		else{
			return getStartCity();
		}
	}
	
	public void setStartAddress(String st_start_address) {
		this.st_start_address = st_start_address;
//		onContentFilling();
	}
	public void setStartAddress(String sn_start_address,boolean isCity) {
		if(isCity){
			this.sn_start_address = sn_start_address;
//			onContentFilling();
		}
		else{
			setStartAddress(sn_start_address);
		}
	}

	public String getStartAddress() {
		return (st_start_address!=null&&!st_start_address.equals(""))?st_start_address:st_start_name;
	}
	public String getStartAddress(boolean isCity) {
		if(isCity){
			return sn_start_address;
		}
		else{
			return getStartAddress();
		}

	}
	public void setStartLongitude(double st_start_longitude) {
		this.st_start_longitude = st_start_longitude;
//		onContentFilling();
	}
	public void setStartLongitude(double sn_start_longitude,boolean isCity) {
		if(isCity){
			this.sn_start_longitude = sn_start_longitude;
//			onContentFilling();
		}
		else{
			setStartLongitude(sn_start_longitude);
		}

	}
	public double getStartLongitude() {
		return st_start_longitude;
	}
	public double getStartLongitude(boolean isCity) {
		if(isCity){
			return sn_start_longitude;
		}
		else{
			return getStartLongitude();
		}
		
	}
	public void setStartLatitude(double st_start_latitude) {
		this.st_start_latitude = st_start_latitude;
//		onContentFilling();
	}
	public void setStartLatitude(double sn_start_latitude,boolean isCity) {
		if(isCity){
			this.sn_start_latitude = sn_start_latitude;
//			onContentFilling();
		}
		else{
			setStartLatitude(sn_start_latitude);
		}

	}
	public double getStartLatitude() {
		return st_start_latitude;
	}
	public double getStartLatitude(boolean isCity) {
		if(isCity){
			return sn_start_latitude;
		}
		else{
			return getStartLatitude();
		}
		
	}
	public void setEndName(String st_end_name) {
		this.st_end_name = st_end_name;
		onContentFilling();
	}
	public void setEndName(String sn_end_name,boolean isCity) {
		if(isCity){
			this.sn_end_name = sn_end_name;
			onContentFilling();
		}
		else{
			setEndName(sn_end_name);
		}

	}
	public String getEndName() {
		return st_end_name;
	}
	public String getEndName(boolean isCity) {
		if(isCity){
			return sn_end_name;
		}
		else{
			return getEndName();
		}
		
	}
	public void setEndCity(String st_end_city) {
		this.st_end_city = st_end_city;
	}
	public void setEndCity(String sn_end_city,boolean isCity) {
		if(isCity){
			this.sn_end_city = sn_end_city;
		}
		else{
			setEndCity(sn_end_city);
		}

	}
	public String getEndCity() {
		try {
			if (st_end_city == null || st_end_city.equals("")||st_end_city.contains(Value.CITY_SPILT)
					||st_end_city.contains("\t")||st_end_city.contains("-")) {
				if(st_end_name.contains(Value.CITY_SPILT)){
					st_end_city = st_end_name.substring(0,
							st_end_name.indexOf(Value.CITY_SPILT));
				}
				else if(st_end_name.contains("\t")){
					st_end_city = st_end_name.substring(0,
							st_end_name.indexOf("\t"));
				}
				else if(st_end_name.contains("-")){
					st_end_city = st_end_name.substring(0,
							st_end_name.indexOf("-"));
				}
				else{
					st_end_city=st_end_name;
				}

			}
		} catch (Exception e) {
		}

		return st_end_city;
	}
	public String getEndCity(boolean isCity) {
		if(isCity){
		try {
			if (sn_end_city == null || sn_end_city.equals("")||sn_end_city.contains(Value.CITY_SPILT)
					||sn_end_city.contains("\t")||sn_end_city.contains("-")) {
				if(sn_end_name.contains(Value.CITY_SPILT)){
					sn_end_city = sn_end_name.substring(0,
							sn_end_name.indexOf(Value.CITY_SPILT));
				}
				else if(sn_end_name.contains("\t")){
					sn_end_city = sn_end_name.substring(0,
							sn_end_name.indexOf("\t"));
				}
				else if(sn_end_name.contains("-")){
					sn_end_city = sn_end_name.substring(0,
							sn_end_name.indexOf("-"));
				}
				else{
					sn_end_city=sn_end_name;
				}

			}
		} catch (Exception e) {
		}

		return sn_end_city;
		}
		else{
			return getEndCity();
		}
	}
	public void setEndAddress(String st_end_address) {
		this.st_end_address = st_end_address;
//		onContentFilling();
	}
	public void setEndAddress(String sn_end_address,boolean isCity) {
		if(isCity){
			this.sn_end_address = sn_end_address;
//			onContentFilling();
		}
		else{
			setEndAddress(sn_end_address);	
		}

	}
	public String getEndAddress() {
		return (st_end_address!=null&&!st_end_address.equals(""))?st_end_address:st_end_name;
	}
	public String getEndAddress(boolean isCity) {
		if(isCity){
			return sn_end_address;
		}
		else{
			return getEndAddress();
		}
		
	}
	public void setEndLongitude(double st_end_longitude) {
		this.st_end_longitude = st_end_longitude;
//		onContentFilling();
	}
	public void setEndLongitude(double sn_end_longitude,boolean isCity) {
		if(isCity){
			this.sn_end_longitude = sn_end_longitude;
//			onContentFilling();
		}
		else{
			setEndLongitude(sn_end_longitude);
		}

	}
	public double getEndLongitude() {
		return st_end_longitude;
	}
	public double getEndLongitude(boolean isCity) {
		if(isCity){
			return sn_end_longitude;	
		}
		else{
			return getEndLongitude();	
		}

	}
	public void setEndLatitude(double st_end_latitude) {
		this.st_end_latitude = st_end_latitude;
//		onContentFilling();
	}
	public void setEndLatitude(double sn_end_latitude,boolean isCity) {
		if(isCity){
			this.sn_end_latitude = sn_end_latitude;
//			onContentFilling();
		}else{
			setEndLatitude(sn_end_latitude);
		}

	}
	public double getEndLatitude() {
		return st_end_latitude;
	}
	public double getEndLatitude(boolean isCity) {
		if(isCity){
			return sn_end_latitude;
		}else{
			return getEndLatitude();
		}
	
	}
	public void setName(String name) {
		this.name = name;
		onContentFilling();
	}

	public String getName() {
		return name;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getTel() {
		return tel;
	}

	public void setName2(String name2) {
		this.name2 = name2;
		onContentFilling();
	}

	public String getName2() {
		return name2;
	}

	public void setTel2(String tel2) {
		this.tel2 = tel2;
		onContentFilling();
	}

	public String getTel2() {
		return tel2;
	}

	public void setMessage_KJ(String message) {
		this.message_kj = message;
	}

	public String getMessage_KJ() {
		return message_kj;
	}
	public void setMessage_PC(String message) {
		this.message_pc = message;
	}

	public String getMessage_PC() {
		return message_pc;
	}
	public void setMessage_BC(String message) {
		this.message_bc = message;
	}
	public String getMessage_BC() {
		return message_bc;
	}
	public void setMessage_GW(String message) {
		this.message_gw = message;
	}

	public String getMessage_GW() {
		return message_gw;
	}
	public void setGoodsWeight(int goods_weight) {
		this.goods_weight = goods_weight;
//		onContentFilling();
	}

	public int getGoodsWeight() {
		return goods_weight;
	}

	public void setGoodsVolume(int goods_volume) {
		this.goods_volume = goods_volume;
//		onContentFilling();
	}

	public int getGoodsVolume() {
		return goods_volume;
	}

	public void setCount(int count) {
		this.count = count;
		onContentFilling();
	}

	public int getCount() {
		return count;
	}
	public void setCount_BC(int count_bc) {
		this.count_bc = count_bc;
		onContentFilling();
	}

	public int getCount_BC() {
		return count_bc;
	}
	public void setPlaneStatus(int plane_status) {
		this.plane_status = plane_status;
		onContentFilling();
	}

	public int getPlaneStatus() {
		return plane_status;
	}

	public void setPlaneNumble(String plane_numble) {
		this.plane_numble = plane_numble;
		onContentFilling();
	}

	public String getPlaneNumble() {
		return plane_numble;
	}
	public void setIsCBclause(boolean  isCBclause) {
		this.isCBclause = isCBclause;
		onContentFilling();
	}

	public boolean  getIsCBclause() {
		return isCBclause;
	}
	public void setIs_mutiple_oncar(int  is_mutiple_oncar) {
		this.is_mutiple_oncar = is_mutiple_oncar;
	}

	public int getIs_mutiple_oncar() {
		return is_mutiple_oncar;
	}
	

	public int getOwn_expense(){
		 return own_expense;
	   }
	public void setOwn_expense(int own_expense){
		 this.own_expense=own_expense;
	}
	/**
	 * 交换起始位置
	 */
	public void onSwap() {
		StringBuffer[] sb_name = new StringBuffer[2];
		sb_name[0] = new StringBuffer(st_start_name + "");
		sb_name[1] = new StringBuffer(st_end_name + "");
		st_start_name = sb_name[1].toString();
		st_end_name = sb_name[0].toString();

		StringBuffer[] sb_city = new StringBuffer[2];
		sb_city[0] = new StringBuffer(st_start_city + "");
		sb_city[1] = new StringBuffer(st_end_city + "");
		st_start_city = sb_city[1].toString();
		st_end_city = sb_city[0].toString();

		StringBuffer[] sb_address = new StringBuffer[2];
		sb_address[0] = new StringBuffer(st_start_address + "");
		sb_address[1] = new StringBuffer(st_end_address + "");
		st_start_address = sb_address[1].toString();
		st_end_address = sb_address[0].toString();

		StringBuffer[] sb_longitude = new StringBuffer[2];
		sb_longitude[0] = new StringBuffer(st_start_longitude + "");
		sb_longitude[1] = new StringBuffer(st_end_longitude + "");
		st_start_longitude = Double.parseDouble(sb_longitude[1].toString());
		st_end_longitude = Double.parseDouble(sb_longitude[0].toString());

		StringBuffer[] sb_latitude = new StringBuffer[2];
		sb_latitude[0] = new StringBuffer(st_start_latitude + "");
		sb_latitude[1] = new StringBuffer(st_end_latitude + "");
		st_start_latitude = Double.parseDouble(sb_latitude[1].toString());
		st_end_latitude = Double.parseDouble(sb_latitude[0].toString());
		onContentFilling();
	}
	/**
	 * 交换起始位置
	 */
	public void onSwap(boolean isCity) {
		if(isCity){
		StringBuffer[] sb_name = new StringBuffer[2];
		sb_name[0] = new StringBuffer(sn_start_name + "");
		sb_name[1] = new StringBuffer(sn_end_name + "");
		sn_start_name = sb_name[1].toString();
		sn_end_name = sb_name[0].toString();

		StringBuffer[] sb_city = new StringBuffer[2];
		sb_city[0] = new StringBuffer(sn_start_city + "");
		sb_city[1] = new StringBuffer(sn_end_city + "");
		sn_start_city = sb_city[1].toString();
		sn_end_city = sb_city[0].toString();

		StringBuffer[] sb_address = new StringBuffer[2];
		sb_address[0] = new StringBuffer(sn_start_address + "");
		sb_address[1] = new StringBuffer(sn_end_address + "");
		sn_start_address = sb_address[1].toString();
		sn_end_address = sb_address[0].toString();

		StringBuffer[] sb_longitude = new StringBuffer[2];
		sb_longitude[0] = new StringBuffer(sn_start_longitude + "");
		sb_longitude[1] = new StringBuffer(sn_end_longitude + "");
		sn_start_longitude = Double.parseDouble(sb_longitude[1].toString());
		sn_end_longitude = Double.parseDouble(sb_longitude[0].toString());

		StringBuffer[] sb_latitude = new StringBuffer[2];
		sb_latitude[0] = new StringBuffer(sn_start_latitude + "");
		sb_latitude[1] = new StringBuffer(sn_end_latitude + "");
		sn_start_latitude = Double.parseDouble(sb_latitude[1].toString());
		sn_end_latitude = Double.parseDouble(sb_latitude[0].toString());
		onContentFilling();
		}
		else{
			onSwap();
		}
	}
	/**
	 * 设置所有的属性
	 */
	public void setAttribute(Context context,OfficialOrderList mOfficialOrderList) {
		isNoListener=true;
		main.setTime("现在出发");
		boolean isCity=(Integer.parseInt(mOfficialOrderList.getOrder_type())==Value.ORDER_TYPE_SN)?true:false;
		main.setStartName(mOfficialOrderList.getOrderDetail().getStart().getAddress(),isCity);
		main.setStartAddress("");//设置地址为空
		main.setStartCity("",isCity);
		main.setStartLatitude(mOfficialOrderList.getOrderDetail().getStart()
				.getLocation().getLat(),isCity);
		main.setStartLongitude(mOfficialOrderList.getOrderDetail().getStart()
				.getLocation().getLng(),isCity);
		main.setEndName(mOfficialOrderList.getOrderDetail().getEnd().getAddress(),isCity);
		main.setEndAddress("");//设置地址为空
		main.setEndCity("",isCity);
		main.setEndLatitude(mOfficialOrderList.getOrderDetail().getEnd().getLocation()
				.getLat(),isCity);
		main.setEndLongitude(mOfficialOrderList.getOrderDetail().getEnd().getLocation()
				.getLng(),isCity);
		main.setTel(mOfficialOrderList.getOrderDetail().getStart().getPhone());
		main.setTel2(mOfficialOrderList.getOrderDetail().getEnd().getPhone());
		main.setName(mOfficialOrderList.getOrderDetail().getStart().getName());
		main.setName2(mOfficialOrderList.getOrderDetail().getEnd().getName());
		main.setWf(mOfficialOrderList.getRound_trip().equals(Value.ROUND_TRIP)?true:false);
		try{
		   main.setOwn_expense(Integer.parseInt(mOfficialOrderList.getOwn_expense()));
		}catch(Exception e){main.setOwn_expense(defaultOwn);}
		if(mOfficialOrderList.getVehicleDetail()!=null){
			main.setMessage_GW(mOfficialOrderList.getVehicleDetail().getPurpose());
		}

		main.setVtype(vtype);
		switch(Integer.parseInt(mOfficialOrderList.getOrder_type())){
		case Value.ORDER_TYPE_SN:
			main.setCount(1);
			main.setMessage_KJ("");
			main.setMessage_PC("");
			main.setMessage_BC("");
			main.setCount_BC(1);
			break;
		case Value.ORDER_TYPE_KJ:
//			main.setCount(mOfficialOrderList.getOrderDetail().getCount());
			main.setMessage_KJ(mOfficialOrderList.getMessage());
			main.setMessage_PC("");
			main.setMessage_BC("");
			main.setCount_BC(1);
			break;
		case Value.ORDER_TYPE_PC:
//			main.setCount(mOfficialOrderList.getOrderDetail().getCount());
			main.setMessage_KJ("");
			main.setMessage_PC(mOfficialOrderList.getMessage());
			main.setMessage_BC("");
			main.setCount_BC(1);
			break;
		case Value.ORDER_TYPE_BC:
			main.setCount(1);
//			main.setCount_BC(mOfficialOrderList.getOrderDetail().getCount());
			main.setMessage_KJ("");
			main.setMessage_PC("");
			main.setMessage_BC(mOfficialOrderList.getMessage());
//			main.setIs_mutiple_oncar(mOfficialOrderList.getOrderDetail().getIs_mutiple_oncar());
			break;
		}	
		
		try {
//			main.setGoodsVolume(Integer.parseInt(mOfficialOrderList.getOrderDetail()
//					.getVolume()));
//			main.setGoodsWeight(Integer.parseInt(mOfficialOrderList.getOrderDetail()
//					.getWeight()));
	
		//设置车型
		String vtype=mOfficialOrderList.mOfficial_VclassInfo.getInfo().getVtype();
		if(vtype==null||vtype.equals("")){
			vtype=Value.vtype_null+"";
		}
		main.setVtype(vtype);
		main.setVtypeId(mOfficialOrderList.mOfficial_VclassInfo.getInfo().getClass_Id());
		main.setLevelCar(mOfficialOrderList.mOfficial_VclassInfo.getInfo().getLevel());
//		main.setOwner_type();//设置默认的不需要重新设置
		main.setSeat_num(mOfficialOrderList.mOfficial_VclassInfo.getInfo().getSeat_Num());
		//时长
		main.setEstimate_time(1);
		//tc_id
		main.setTc_id(mOfficialOrderList.getTcId());
		
		//设置汽车具体类型，，如商务轿车(舒适)
		int position=0;
		for(int i=0;i<Value.list_vtype.length;i++){
			//根据类型判断当前是第几项
			if( Integer.parseInt(main.getVtype())==Value.list_vtype[i]){
				position=i;
				break;
			}
		}
		switch (Integer.parseInt(main.getVtype())) {
		case 1:
		case 2:
			String type = "";
			switch (Integer.parseInt(main.getLevelCar())) {
			case 1:
				type = Value.car_type[0];
				break;
			case 2:
				type = Value.car_type[1];
				break;
			case 3:
				type = Value.car_type[2];
				break;
			}
			main.setVtypeTitle(context
					.getString(OfficialFragment.car_name[position]) + " " + type);
			break;

		case 3:
		case 4:
		case 5:
			main.setVtypeTitle(context
					.getString(OfficialFragment.car_name[position])
					+ " "
					+ main.getSeat_num()+"座");
			break;
		}
		setNullPosition();
		setNullPrevCar();
		} catch (Exception e) {
		}
		//这边不要自动判断数据是否填写完整
//		isNoListener=false;
//		onContentFilling();
	}

	/**
	 * 还原属性值
	 */
	public void onRestoreAttribute() {
		isNoListener=true;
		MyApplication mApplication = MyApplication.getInstance();
		main.setStartName("",true);
		main.setStartName("",false);
		main.setStartCity("",true);
		main.setStartCity("",false);
		main.setStartAddress("");
		main.setStartLatitude(0,true);
		main.setStartLatitude(0,false);
		main.setStartLongitude(0,true);
		main.setStartLongitude(0,false);
		main.setEndName("",true);
		main.setEndName("",false);
		main.setEndCity("",true);
		main.setEndCity("",false);
		main.setEndAddress("");
		main.setEndLatitude(0,true);
		main.setEndLatitude(0,false);
		main.setEndLongitude(0,true);
		main.setEndLongitude(0,false);
		main.setTel(mApplication.getUserphone());
		main.setTel2("");
		main.setName(mApplication.getRealName());
		main.setName2("");
		main.setCount(1);
		main.setCount_BC(1);
		main.setGoodsVolume(0);
		main.setGoodsWeight(0);
		main.setMessage_KJ(null);
		main.setMessage_PC(null);
		main.setMessage_BC(null);
		main.setTime("现在出发");
		main.setWf(false);
		main.setMessage_GW("");
		main.setOwn_expense(defaultOwn);
		//设置车型
		main.setVtype(Value.list_vtype[0]+"");
		main.setVtypeId("");
		main.setLevelCar("");
		main.setVtypeIndex(0);
//		main.setOwner_type();//设置默认的不需要重新设置
		main.setSeat_num("");
		main.setEstimate_time(Value.estimate_time);
		main.setVtypeTitle("");
		setNullPosition();
		setNullPrevCar();
		onRestoreCar();
		isNoListener=false;
		onContentFilling();
	}
	/**
	 * 还原车型值
	 */
	public void onRestoreCar(){
		if(defaultLevel!=null&&defaulSeat_num!=null&&defaulVtype!=null&&defaulVtypeId!=null&&defaulTcId!=null){
		main.setLevelCar(defaultLevel);
		main.setSeat_num(defaulSeat_num);
		main.setVtype(defaulVtype);
		main.setVtypeId(defaulVtypeId);
		main.setTc_id(defaulTcId);
		main.setComboPrice(defaulComboPrice);
		main.setVtypeTitle(defaulVtypetitle);
		}
	}
	public String defaultLevel;
	public String defaulSeat_num;
	public String defaulVtype;
	public String defaulVtypeId;
	public String defaulTcId;
	public String defaulComboPrice;
	public String defaulVtypetitle;
	/**
	 * 设置默认车型值
	 */
	public void setDefaultCar(String level,String seat_num,String vtype,String vtype_id,String tc_id,String comboprice,String vtypetitle){
		defaultLevel=level;
		defaulSeat_num=seat_num;
		defaulVtype=vtype;
		defaulVtypeId=vtype_id;
		defaulTcId=tc_id;
		defaulComboPrice=comboprice;
		defaulVtypetitle=vtypetitle;
	}
	public String prevLevel;
	public String prevSeat_num;
	public String prevVtype;
	public String prevVtypeId;
	public String prevTcId;
	public String prevComboPrice;
	public String prevVtypetitle;
	/**
	 * 设置上一个车型值
	 */
	public void setPrevCar(String level,String seat_num,String vtype,String vtype_id,String tc_id,String comboprice,String vtypetitle){
		prevLevel=level;
		prevSeat_num=seat_num;
		prevVtype=vtype;
		prevVtypeId=vtype_id;
		prevTcId=tc_id;
		prevComboPrice=comboprice;
		prevVtypetitle=vtypetitle;
	}
	/**
	 * 还原上一个车型值
	 */
	public void onRestorePrevCar(){
		if(prevLevel!=null&&prevSeat_num!=null&&prevVtype!=null&&prevVtypeId!=null&&prevTcId!=null){
		main.setLevelCar(prevLevel);
		main.setSeat_num(prevSeat_num);
		main.setVtype(prevVtype);
		main.setVtypeId(prevVtypeId);
		main.setTc_id(prevTcId);
		main.setComboPrice(prevComboPrice);
		main.setVtypeTitle(prevVtypetitle);
		}
	}
	public void setNullPrevCar(){
		prevLevel="";
		prevSeat_num="";
		prevVtype="";
		prevVtypeId="";
		prevTcId=getTc_id();
		prevComboPrice="";
		prevVtypetitle="";
	}
	/**
	 * 调用内容填充监听方法，用来监听必选的内容是否全部填满
	 */
	public void onContentFilling() {
		if (mOnContentFillingListener != null&&!isNoListener) {
			mOnContentFillingListener.onContentFilling();
		}
	}
}
